<?php if (isset($_SESSION['user'])): ?>
<div class="setting-sync">
	<div id="setting-sync-container">
		<div style="position:relative" class="sync-block sync-block-left sync-block-sina">
			<?php
				require_once('application.php');
				require_once(ROOT_DIR."/dao/db.php");
				require_once(ROOT_DIR."/dao/user_dao.php");
				$user_id = $_SESSION['user']['user_id'];
				$user = UserDao::getUser($user_id);
				if ($user == false || $user['sina'] == 0): 
			?>
			<form action="/settings/sync" method="post" class="update-sync-form">
				<input type="hidden" value="sina" name="service">
				<table width="100%" class="sync sina">
					<tbody><tr><td class="label"><img width="54" height="18" src="img/sync-to.png"></td><td><img width="116" height="35" src="http://static.jiepang.com/static/img/sina.png?c14c"></td></tr>
						<tr><td align="center" style="font-size: 13px; font-weight: bold" colspan="2"><a href="server/to_sync.php?via=sina" id="sync-sina-url">&gt;&gt; 去新浪上设置同步 &lt;&lt;</a></td></tr>
					</tbody>
				</table>
			</form>
			<?php else: ?>
			<div class="sync-success">
				<div class="img-success png"></div>
				<div class="sync-status"></div>
				<div class="sync-text">已同步到新浪微博 <button onclick="cancelSync('sina')" class="sync-cancel png nohover"></button></div>
			</div>
			<?php endif; ?>
		</div>
		<div style="position:relative" class="sync-block sync-block-right sync-block-renren">
			<?php if ($user == false || $user['renren'] == 0): ?>
			<form action="/settings/sync" method="post" class="update-sync-form">
				<input type="hidden" value="renren" name="service">
				<table width="100%" class="sync renren">
					<tbody><tr><td class="label"><img width="54" height="18" src="img/sync-to.png"></td><td><img width="116" height="35" src="http://static.jiepang.com/static/img/renren.png?c14c"></td></tr>
							<tr><td align="center" style="font-size: 13px; font-weight: bold" colspan="2"><a href="server/to_sync.php?via=renren">&gt;&gt; 去人人网设置同步 &lt;&lt;</a></td></tr>
						</tbody></table>
			</form>
			<?php else: ?>
			<div class="sync-success">
				<div class="img-success png"></div>
				<div class="renren-sync-status"></div>
				<div class="sync-text">已同步到人人 <button onclick="cancelSync('renren')" class="sync-cancel png nohover"></button></div>
			</div>
			<?php endif; ?>
		</div>
	</div>
</div>
<?php else:?>
	header("Location: {ROOT_URL.index.php}");
<?php endif;?>